/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *       http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.apache.hop.run;

import org.apache.hop.core.HopVersionProvider;
import org.apache.hop.core.Result;
import org.apache.hop.metadata.api.IHasHopMetadataProvider;
import org.apache.hop.metadata.serializer.multi.MultiMetadataProvider;
import picocli.CommandLine;

@CommandLine.Command(versionProvider = HopVersionProvider.class)
public class HopRun implements Runnable, IHasHopMetadataProvider {

  public HopRun() {}

  /**
   * Gets realFilename
   *
   * @return value of realFilename
   */
  public String getRealFilename() {
    return "";
  }

  /**
   * @param realFilename The realFilename to set
   */
  public void setRealFilename(String realFilename) {}

  /**
   * Gets filename
   *
   * @return value of filename
   */
  public String getFilename() {
    return "";
  }

  /**
   * @param filename The filename to set
   */
  public void setFilename(String filename) {}

  /***
   * 运行工作流 String url = "-prj samples -r local -f /home/softrobot/webapps/ROOT/BOOT-INF/config/projects/samples/88api/python_json.hpl -p prompt=123456";
   * @param args 参数
   * @return 返回结果
   */
  public Result runCmd(String[] args) {
    HopRunParam hop = new HopRunParam();
    return hop.runCmd(args);
  }

  /***
   * 初始化服务器
   * @param args 参数
   */
  public void initPipeSvr(String[] args) {
    HopRunParam.initPipeSvr(null);
  }

  public static void main(String[] args) {
    HopRun run = new HopRun();
    run.initPipeSvr(null);
    String cmd =
        "-prj samples -l NOTHING -r local -f /home/datagov/softrobot/webapps/ROOT/BOOT-INF/config/projects/samples/api/v1/echoA.hpl --parameters=";
    String[] param = cmd.split(" ");
    run.runCmd(param);
  }

  @Override
  public void run() {}

  @Override
  public MultiMetadataProvider getMetadataProvider() {
    return null;
  }

  @Override
  public void setMetadataProvider(MultiMetadataProvider metadataProvider) {}
}
